package best.driver.android.Activity.Environment;

import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.TextView;
import best.driver.android.Activity.Base.BaseActivity;
import best.driver.android.AppConfig;
import best.driver.android.Event.DownloadApkEvent;
import best.driver.android.Model.OrderDetailModel;
import best.driver.android.R;
import best.driver.android.Utils.Logger;
import best.driver.android.manager.UserInfoManager;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import de.greenrobot.event.EventBus;


public class DownLoadApkActivity extends BaseActivity{

    @InjectView(R.id.pb_update_download)
    ProgressBar mPbUpdateDownload;

    @InjectView(R.id.tv_download_desc)
    TextView mTvDownloadDesc;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setView(R.layout.activity_download_apk);
        ButterKnife.inject(this, view);
        EventBus.getDefault().register(this);
        setTopTopic("版本更新");

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    public void onEventMainThread(DownloadApkEvent event) {
        mPbUpdateDownload.setProgress(event.process);
        mTvDownloadDesc.setText(String.format(getString(R.string.download_process), event.process));
//        Logger.d("percent_event_llalala: ", event.process+"");
        if(event.process == 100) {
            mTvDownloadDesc.setText(getString(R.string.download_completed));
        }
    }



}
